package 区间分组;

import java.util.*;

public class Main {
    static int N = 200010, n;
    static PII[] q = new PII[N];
    static int[] g = {-1, -1};

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        for (int i = 0; i < n; i++) {
            int l = in.nextInt();
            int r = in.nextInt();
            q[i] = new PII(l, r);
        }
        Arrays.sort(q, 0, n);
        if (check()) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }

    private static boolean check() {
        for (int i = 0; i < n; i++) {
            PII t = q[i];
            if (t.l > g[0]) {
                g[0] = t.r;
            } else if (t.l > g[1]) {
                g[1] = t.r;
            } else {
                return false;
            }
        }
        return true;
    }
}

class PII implements Comparable<PII> {
    int l, r;

    public PII(int l, int r) {
        this.l = l;
        this.r = r;
    }

    @Override
    public int compareTo(PII o) {
        return Integer.compare(this.l, o.l);
    }
}